package com.itheima.practice01;

public class TestDemo02 {

    public static void main(String[] args) {

     //   changeNum(23,10);


/*
        int[]  num={11,55,22,33,44};

        changeArray(num);*/


        int[][] num={{1,2,3},{4,5,6},{7,8,9}};

        int a=getSum(num);
        System.out.println(a);


    }

    //数据交换
   /* public static void  changeNum(int a,int b){

        System.out.println("原a和b的值是:"+a+" , "+b);

        int temp=0;
        temp=a;
        a=b;
        b=temp;

        System.out.println("交换后的a和b的值:"+a+" , "+b);
*/


   //数组反转
       /* public static void  changeArray(int[] arr){

            for (int i = 0,j=arr.length-1; i < j; i++,j--) {

                int temp=0;

                temp=arr[i];
                arr[i]=arr[j];
                arr[j]=temp;
            }

            for (int i = 0; i < arr.length; i++) {
                System.out.print(arr[i]+" ");
            }
*/

       //二维数组求和

    public static int getSum(int[][] arr){

        int sum=0;

        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                sum+=arr[i][j];
            }
        }
        return sum;

    }



}


